/*
* @Author: monster
* @Date:   2017-09-19 01:55:55
* @Last Modified by:   monster
* @Last Modified time: 2017-09-22 22:02:21
*/
'use strict';

angular.module('app').directive('appPositionList',['cache','$http',function(cache,$http){
	return{
		restrict : 'A',
		replace  : true,
		templateUrl : 'view/template/positionList.html',
		// 抛出接口data，与mainCtrl共享scope
		scope : {
			data : '=',
			filterObj : '=',
			isFavorite : '='
		},
		link : function($scope){
			// 定义点击收藏方法
			$scope.select = function(item){
				$http.post('data/favorite.json',{
					id : item.id,
					select : !item.select
				}).success(function(resp){
					item.select = !item.select
				})
			}
		}
	};
}]);